//
//  homeTitleButton.swift
//  CLWeiBo
//
//  Created by 程雷 on 15/6/28.
//  Copyright © 2015年 程雷. All rights reserved.
//

import UIKit

class homeTitleButton: UIButton {

///  抽取设置按钮的方法
    class func button(title:String) ->homeTitleButton {
        let btn = homeTitleButton()
        btn.setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        btn.titleLabel?.font = UIFont.systemFontOfSize(17.0)
        btn.setTitle(title, forState: UIControlState.Normal)
        btn.setImage(UIImage(named: "navigationbar_arrow_down"), forState: UIControlState.Normal)
        btn.sizeToFit()
        
        return btn
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
 /// 在 swift 中能直接改变 frame的值
        titleLabel!.frame.origin.x = 0
        imageView!.frame.origin.x = titleLabel!.bounds.width

    }

}
